<?php
/**
 * Abstracte klasse voor een Mapper Model
 *
 * @category   Ahs
 * @package    Ahs_Model
 * @author     Olivier Parent
 * @copyright  Copyright (c) 2011 Artevelde University College Ghent
 */
abstract class Ahs_Model_Mapper extends Ahs_Model
{

    /**
     * @var Zend_Db_Table_Abstract
     */
    protected $_dbTable;
    /**
     * @var string
     */
    protected $_dbTableName;
 
    public function getDbTable()
    {
        if (null === $this->_dbTable) {
            $this->setDbTable($this->_dbTableName);
        }
        return $this->_dbTable;
    }
    
    public function setDbTable($dbTable)
    {
        if (is_string($dbTable)) {
            $dbTable = new $dbTable();
        }
        if (!$dbTable instanceof Zend_Db_Table_Abstract) {
            throw new Exception('Invalid table data gateway provided');
        }
        $this->_dbTable = $dbTable;
        return $this;
    }
    
    public function getDbTableName()
    {
        return $this->_dbTableName;
    }

    public function setDbTableName($dbTableName)
    {
        $this->_dbTableName = $dbTableName;
    }

}
